import { createSlice } from "@reduxjs/toolkit";

export const todolistSlice = createSlice({
  name: "todolist",
  initialState: {
    list: [
      {
        content: "学习 React",
        status: false,
      },
    ],
  },
  reducers: {
    add(state, { payload }) {
      state.list.push({
        content: payload,
        status: false,
      });
    },
  },
});

export const { add } = todolistSlice.actions;

export default todolistSlice.reducer;
